<%@ page language="java"  pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>



	
<div class="com_pd_s1">
	<div class="box_s2">
		<div class="title"><img src="images/other/icon_19.jpg" /><span>日程发布</span></div>
		<div class="content">
			<table class="form_info">
				<tr>
					<td width="87" class="col1">日期：</td>
					<td><input type="text" id="start_time" class="def_txt_s1" onclick="WdatePicker({el:'start_time',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,isShowClear:false});"
					 <s:if test="day != null && day != ''">value='<s:property value="day"/> 00:00:00'</s:if>
					 <s:if test="day == null || day == ''">value='<s:date name="schedule.startTime" format="yyyy-MM-dd HH:mm:ss" />'</s:if>
					  /></td>
				</tr>
				
				<tr>
					<td width="87" class="col1">标题：</td>
					<td><input type="text" class="def_txt_s1" value="<s:property value="schedule.title"/>" id="title"/></td>
				</tr>
				<tr>
					<td width="87" class="col1 vt">内容：</td>
					<td>
						<textarea class="def_ta" id="content"><s:property value="schedule.content"/></textarea>
						<div class="operate">
							<input type="button" value="发布" class="def_btn_s1" onclick="sendSchedule()"/>
							<input type="button" value="取消" class="def_btn_s1" onclick="window.location.href='schedule!view.do'" style="margin-right: 10px;"/>
						</div>
					</td>
				</tr>
				
			</table>
		</div>
	</div>
	
</div>
           
         
    <!-- body -->
    <script type="text/javascript">
    	function sendSchedule(){
    		var startTime = $("#start_time").val();
    		var title = $("#title").val();
    		var content = $("#content").val();
    		if(startTime == null || startTime == ""){
    			alert("日期不能为空！");
    			return false;
    		}
    		if(title == null || title == ""){
    			alert("标题不能为空！");
    			return false;
    		}
    		if(content == null || content == ""){
    			alert("内容不能为空！");
    			return false;
    		}
    		$.post("schedule!save.do",{
    			'schedule.id':'<s:property value="schedule.id"/>',
    			'schedule.startTime':startTime,
    			'schedule.title':title,
    			'schedule.content':content
    		},function(data){
    			if(data!=null){
    				var ret = $.parseJSON(data);
    				if(ret.success == 'true'){
    					$("#schedule_list").load("schedule!manage.do?day="+startTime.substring(0,10));
    					
    				}else{
    					alert(ret.msg);
    				}
    			}
    		});
    	}
    </script>
